﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ReadyApps.Data;
using ReadyApps.Data.Wiki;

namespace ReadyAppsTest.Data
{
    class TestWikiDataProvider : IWikiDataProvider
    {
        #region Properties

        public string ConnectionString { get; set; }

        #endregion

        #region Method Call Parameters

        public string CreateNewSite_siteName { get; private set; }
        public bool CreateNewSite_securityEnabled { get; private set; }
        public string CreateNewSite_initialPath { get; private set; }
        public string CreateNewSite_creator { get; private set; }
        public string CreateNewPage_siteName { get; private set; }
        public string CreateNewPage_fullPath { get; private set; }
        public string CreateNewPage_pageName { get; private set; }
        public string CreateNewPage_author { get; private set; }
        public PageContent CreateNewPage_content { get; private set; }
        public int CloneRevisionToHead_pageID { get; private set; }
        public int CloneRevisionToHead_revisionNumber { get; private set; }
        public string CloneRevisionToHead_author { get; private set; }
        public string LookupPage_siteName { get; private set; }
        public string LookupPage_folder { get; private set; }
        public string LookupPage_pageName { get; private set; }
        public int GetPageFolder_pageID { get; private set; }
        public int GetPageDetails_pageID { get; private set; }
        public int GetPageTitle_pageID { get; private set; }
        public int GetPagePermissions_pageID { get; private set; }
        public int GetFolderPermissions_folderID { get; private set; }
        public int GetFolderPermissionsForPage_pageID { get; private set; }
        public int GetPagesInFolder_folderID { get; private set; }
        public int GetPageContent_pageID { get; private set; }
        public int GetPageContentForPending_pageID { get; private set; }
        public int GetPageContentForRevision_pageID { get; private set; }
        public int GetPageContentForRevision_revisionNumber { get; private set; }
        public int GetEditPermissions_pageID { get; private set; }
        public int SavePagePermissions_pageID { get; private set; }
        public EditPermissions SavePagePermissions_editPermissionsData { get; private set; }
        public int RemovePageSpecificPermissions_pageID { get; private set; }
        public string GetAvailablePageLinks_folder { get; private set; }
        public int GetAvailablePageLinks_pageID { get; private set; }
        public bool GetAvailablePageLinks_removeSuppliedPage { get; private set; }
        public int UpdatePage_pageID { get; private set; }
        public string UpdatePage_author { get; private set; }
        public PageContent UpdatePage_content { get; private set; }
        public bool UpdatePage_publish { get; private set; }
        public int GetPageRevisionList_pageID { get; private set; }
        public int GetRetentionSettings_pageID { get; private set; }
        public RetentionSettings SaveRetentionSettings_retentionSettings { get; private set; }
        public int GetPublicationSettings_pageID { get; private set; }
        public int SavePublicationSettings_pageID { get; private set; }
        public PublicationSettings SavePublicationSettings_publicationSettings { get; private set; }
        public int PublishPage_pageID { get; private set; }
        public int DeletePendingRevision_pageID { get; private set; }

        #endregion

        #region Method Return Values

        public PageLookup LookupPage_ReturnValue { get; set; }
        public int GetPageFolder_ReturnValue { get; set; }
        public PageDetails GetPageDetails_ReturnValue { get; set; }
        public string GetPageTitle_ReturnValue { get; set; }
        public bool GetPagePermissions_pageSpecificPermissions { get; set; }
        public PermissionSet GetPagePermissions_ReturnValue { get; set; }
        public PermissionSet GetFolderPermissions_ReturnValue { get; set; }
        public PermissionSet GetFolderPermissionsForPage_ReturnValue { get; set; }
        public List<PageInformation> GetPagesInFolder_ReturnValue { get; set; }
        public EditPermissions GetEditPermissions_ReturnValue { get; set; }
        public PageContent GetPageContent_ReturnValue { get; set; }
        public PageContent GetPageContentForPending_ReturnValue { get; set; }
        public PageContent GetPageContentForRevision_ReturnValue { get; set; }
        public List<AvailablePageLink> GetAvailablePageLinks_ReturnValue { get; set; }
        public List<PageInformation> GetPageRevisionList_ReturnValue { get; set; }
        public RetentionSettings GetRetentionSettings_ReturnValue { get; set; }
        public PublicationSettings GetPublicationSettings_ReturnValue { get; set; }

        #endregion

        #region Methods

        public void CreateNewSite(string siteName, bool securityEnabled, string initialPath, string creator)
        {
            CreateNewSite_siteName = siteName;
            CreateNewSite_securityEnabled = securityEnabled;
            CreateNewSite_initialPath = initialPath;
            CreateNewSite_creator = creator;
        }

        public void CreateNewPage(string siteName, string fullPath, string pageName, string author, PageContent content)
        {
            CreateNewPage_siteName = siteName;
            CreateNewPage_fullPath = fullPath;
            CreateNewPage_pageName = pageName;
            CreateNewPage_author = author;
            CreateNewPage_content = content;
        }

        public void CloneRevisionToHead(int pageID, int revisionNumber, string author)
        {
            CloneRevisionToHead_pageID = pageID;
            CloneRevisionToHead_revisionNumber = revisionNumber;
            CloneRevisionToHead_author = author;
        }

        public void SetConnectionString(string connectionString)
        {
            ConnectionString = connectionString;
        }

        public PageLookup LookupPage(string siteName, string folder, string pageName)
        {
            LookupPage_siteName = siteName;
            LookupPage_folder = folder;
            LookupPage_pageName = pageName;
            return LookupPage_ReturnValue;
        }

        public int GetPageFolder(int pageID)
        {
            GetPageFolder_pageID = pageID;
            return GetPageFolder_ReturnValue;
        }

        public PageDetails GetPageDetails(int pageID)
        {
            GetPageDetails_pageID = pageID;
            return GetPageDetails_ReturnValue;
        }

        public string GetPageTitle(int pageID)
        {
            GetPageTitle_pageID = pageID;
            return GetPageTitle_ReturnValue;
        }

        public PermissionSet GetPagePermissions(int pageID, out bool pageSpecificPermissions)
        {
            GetPagePermissions_pageID = pageID;
            pageSpecificPermissions = GetPagePermissions_pageSpecificPermissions;
            return GetPagePermissions_ReturnValue;
        }

        public PermissionSet GetFolderPermissions(int folderID)
        {
            GetFolderPermissions_folderID = folderID;
            return GetFolderPermissions_ReturnValue;
        }

        public PermissionSet GetFolderPermissionsForPage(int pageID)
        {
            GetFolderPermissionsForPage_pageID = pageID;
            return GetFolderPermissionsForPage_ReturnValue;
        }

        public IEnumerable<PageInformation> GetPagesInFolder(int folderID)
        {
            GetPagesInFolder_folderID = folderID;
            return GetPagesInFolder_ReturnValue;
        }

        public EditPermissions GetEditPermissions(int pageID)
        {
            GetEditPermissions_pageID = pageID;
            return GetEditPermissions_ReturnValue;
        }

        public void SavePagePermissions(int pageID, EditPermissions editPermissionsData)
        {
            SavePagePermissions_pageID = pageID;
            SavePagePermissions_editPermissionsData = editPermissionsData;
        }

        public void RemovePageSpecificPermissions(int pageID)
        {
            RemovePageSpecificPermissions_pageID = pageID;
        }

        public PageContent GetPageContent(int pageID)
        {
            GetPageContent_pageID = pageID;
            return GetPageContent_ReturnValue;
        }

        public PageContent GetPageContentForPending(int pageID)
        {
            GetPageContentForPending_pageID = pageID;
            return GetPageContentForPending_ReturnValue;
        }

        public PageContent GetPageContentForRevision(int pageID, int revisionNumber)
        {
            GetPageContentForRevision_pageID = pageID;
            GetPageContentForRevision_revisionNumber = revisionNumber;
            return GetPageContentForRevision_ReturnValue;
        }

        public IEnumerable<AvailablePageLink> GetAvailablePageLinks(string folder, int pageID, bool removeSuppliedPage)
        {
            GetAvailablePageLinks_folder = folder;
            GetAvailablePageLinks_pageID = pageID;
            GetAvailablePageLinks_removeSuppliedPage = removeSuppliedPage;
            return GetAvailablePageLinks_ReturnValue;
        }

        public void UpdatePage(int pageID, string author, PageContent content, bool publish)
        {
            UpdatePage_pageID = pageID;
            UpdatePage_author = author;
            UpdatePage_content = content;
            UpdatePage_publish = publish;
        }

        public IEnumerable<PageInformation> GetPageRevisionList(int pageID)
        {
            GetPageRevisionList_pageID = pageID;
            return GetPageRevisionList_ReturnValue;
        }

        public RetentionSettings GetRetentionSettings(int pageID)
        {
            GetRetentionSettings_pageID = pageID;
            return GetRetentionSettings_ReturnValue;
        }

        public void SaveRetentionSettings(RetentionSettings retentionSettings)
        {
            SaveRetentionSettings_retentionSettings = retentionSettings;
        }

        public PublicationSettings GetPublicationSettings(int pageID)
        {
            GetPublicationSettings_pageID = pageID;
            return GetPublicationSettings_ReturnValue;
        }

        public void SavePublicationSettings(int pageID, PublicationSettings publicationSettings)
        {
            SavePublicationSettings_pageID = pageID;
            SavePublicationSettings_publicationSettings = publicationSettings;
        }

        public void PublishPage(int pageID)
        {
            PublishPage_pageID = pageID;
        }

        public void DeletePendingRevision(int pageID)
        {
            DeletePendingRevision_pageID = pageID;
        }

        #endregion
    }
}
